import { request } from './request'

// 订单预览
export function orderProview() {
  return request({
    url: '/api/orders/preview'
  })
}

// 提交订单
export function createOrder(data) {
  return request({
    url: '/api/orders',
    method: 'post',
    data
  })
}

// 订单详情
export function getOrderInfo(orderId, params) {
  return request({
    url: `/api/orders/${orderId}`,
    params
  })
}

// 订单列表
export function getOrderList(params) {
  return request({
    url: '/api/orders',
    params
  })
}

// 物流详情
export function expressDetail(orderId) {
  return request({
    url: `/api/orders/${orderId}/express`
  })
}

// 确认收货
export function confirmToke(orderId) {
  return request({
    url: `/api/orders/${orderId}/confirm`,
    method: 'patch'
  })
}

// 评价商品
export function commentGoods(orderId, data) {
  return request({
    url: `/api/orders/${orderId}/comment`,
    method: 'post',
    data
  })
}

// 支付二维码
export function payCode(orderId, params) {
  return request({
    url: `/api/orders/${orderId}/pay`,
    params
  })
}

// 支付状态
export function payStatus(orderId) {
  return request({
    url: `/api/orders/${orderId}/status`
  })
}
